package com.haixiaoke.saas.apartment.service;

import com.haixiaoke.saas.apartment.domain.HousingAllocation;
import com.haixiaoke.saas.house.domain.House;
import com.haixiaoke.saas.system.domain.SysArea;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 房屋配置Service接口
 *
 * @author panda
 * @date 2024-03-21
 */
public interface IHousingAllocationService {
    /**
     * 查询房屋配置
     *
     * @param houseId 房屋配置主键
     * @return 房屋配置
     */
    HousingAllocation selectHousingAllocationByAllocationId(String houseId);

    /**
     * 查询房屋配置列表
     *
     * @param housingAllocation 房屋配置
     * @return 房屋配置集合
     */
    List<HousingAllocation> selectHousingAllocationList(HousingAllocation housingAllocation);

    /**
     * 新增房屋配置
     *
     * @param housingAllocation 房屋配置
     * @return 结果
     */
    int insertHousingAllocation(HousingAllocation housingAllocation);

    /**
     * 修改房屋配置
     *
     * @param housingAllocation 房屋配置
     * @return 结果
     */
    int updateHousingAllocation(HousingAllocation housingAllocation);

    /**
     * 批量删除房屋配置
     *
     * @param allocationIds 需要删除的房屋配置主键集合
     * @return 结果
     */
     int deleteHousingAllocationByAllocationIds(Long[] allocationIds);

    /**
     * 删除房屋配置信息
     *
     * @param allocationId 房屋配置主键
     * @return 结果
     */
     int deleteHousingAllocationByAllocationId(Long allocationId);

    /**
     * 根据房屋id查询房屋配置
     * @param houseId
     * @return
     */
    HousingAllocation selectHousingAllocationByHouseId(String houseId);

    /**
     * 软删除房屋配置
     * @param allocationId 房屋配置id
     * @return
     */
    int softDeleteHousingAllocationByAllocationId(Long allocationId);

    /**
     * 根据房屋id查询房屋配置是否已经添加
     * @param houseId 房屋id
     * @return
     */
    Boolean checkAllocationByHouse(String houseId);

    /**
     * 统计上下架数量，未配置数量，及全部房屋的数量
     * @return
     */
    List<Map<String, Object>> countByState(String tenantId);

    /**
     * 修改房屋配置的上下架状态
     */
    int updateHousingAllocationState(HousingAllocation housingAllocation);

    /**
     * 价格日历列表查询房屋信息
     * @param allocation
     * @return
     */
    List<HousingAllocation> selectCalendarPriceListByAllocation(HousingAllocation allocation);

    Map<String, Map<String, Object>> selectAllocationIdAndHouseId(String[] houseIds);

    /**
     * 公寓小程序首页筛选分页
     * @param housingAllocation
     * @return
     */
    List<HousingAllocation> selectHousingAllocationHomePage(HousingAllocation housingAllocation);
    List<HousingAllocation> selectHousingAllocationHomePageList(HousingAllocation housingAllocation);

    /**
     * 公寓小程序查看房间详情
     */
    HousingAllocation flatSelectHousingAllocationByHouseId(HousingAllocation allocation);

    List<HousingAllocation> selectHouseByAllocation(House house);

    /**
     * 统计时间段内预估金额
     * @param allocation
     * @return
     */
    HousingAllocation flatestimatedAmount(HousingAllocation allocation);

    /**
     * 检验所选时间范围是否超过房屋设定范围
     *
     * @param houseId 房屋id
     * @param endTime 结束时间
     * @return true为超出时间范围, false则相反
     */
    boolean checkTimeRange(String houseId, Date endTime);

    List<SysArea> selectHousingAllocationArea();


    /**
     * 根据房屋id集合查询房屋配置集合
     *
     * @param houseIds
     * @return
     */
    List<HousingAllocation> selectAllocationByHouseIds(List<String> houseIds);

    /**
     * 预估公寓退订价格
     * @param allocation
     * @return
     */
    List<Map<String,Object>> unsubscribeAmount(HousingAllocation allocation);
}
